Skip to content

fix: validate category refs in CI + fix 4 servers with unknown categories - #119

Merged
its-mash merged 1 commit into
mainfrom
fix/invalid-categories-and-ci-validator
Apr 25, 2026
Merged

fix: validate category refs in CI + fix 4 servers with unknown categories#119
its-mash merged 1 commit into
mainfrom
fix/invalid-categories-and-ci-validator

Conversation

@its-mash

Copy link
Copy Markdown
Member

Summary

Four server definitions reference categories that don't exist in `categories.json`. The bundler's `server_categories` table has a foreign key to `categories.id`, so when these servers reach the upsert step the FK throws and the entire row is dropped — meaning any update to those four files never made it to production. CI didn't catch it because schema validation treats `categories` as an opaque string array, and the category-reference check lived only in the test suite, which CI wasn't running.

Data fixes

File Before After
`ai.suprsonic-mcp-npx.json` `web-scraping` dropped (kept `search`, `ai-ml`, `communication`)
`app.businys-mcp-npx.json` `business`, `crm` `productivity`, `communication`
`dev.agentdeals-mcp-http.json` `business` `productivity`
`io.global-chat-mcp-npx.json` `search-web` `search`

Validator changes

  • `scripts/validate.js` now loads `categories.json` and rejects any server that references an unknown ID, printing the full list of valid IDs so contributors can pick the right one.
  • `.github/workflows/validate-pr.yml` runs on changes to `categories.json`, `schemas/`, `scripts/`, and `tests/` in addition to `servers/`, and now runs `npm test` after validate + conflict checks so cross-file consistency (deprecated `icon` field, logo URL format, category refs) is enforced on every PR.
  • Fixed one pre-existing test fixture that used `type: "password"` (not a valid input type per the schema).

Test plan

  • `pnpm validate:all` — all 117 servers pass
  • `pnpm test` — 38/38 tests pass
  • `pnpm validate ` — fails with a clear message listing every valid category ID
  • Post-merge: bundler webhook should now upsert all 4 fixed servers; no more `FOREIGN KEY constraint failed` errors in bundler logs

Companion

A separate bundler PR hardens `upsertServer` to skip (with a warning) any unknown category IDs instead of throwing — defense-in-depth so a future drift between `categories.json` here and the `categories` table in D1 can't silently break sync.

…ries

Four server definitions referenced categories not present in
\`categories.json\` (\`web-scraping\`, \`business\`, \`crm\`, \`search-web\`).
These silently failed to sync in the bundler because server_categories
has a FK to categories.id — the upsert threw and dropped the entire
server, so any update to these four files never reached production.

- Fix the four offenders to use valid categories:
    ai.suprsonic-mcp-npx  web-scraping           -> dropped (kept search, ai-ml, communication)
    app.businys-mcp-npx   business, crm          -> productivity, communication
    dev.agentdeals-mcp-http  business            -> productivity
    io.global-chat-mcp-npx   search-web          -> search
- Extend scripts/validate.js to load categories.json and reject any
  server that references an ID not listed there. Reports the full list
  of valid IDs on failure so contributors can pick the right one.
- Broaden the Validate PR workflow so changes to categories.json,
  schemas, scripts, or tests all trigger validation. Added a "Run full
  test suite" step so cross-file checks (consistency, categories,
  deprecated icon field, logo URL format) run on every PR.
- Fix the one pre-existing \`type: "password"\` test fixture, which was
  always invalid under the input schema but went unnoticed because CI
  didn't run the test suite.

Verified \`pnpm validate servers/<bad>\` now prints a clear error listing
every valid category ID.

Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
@its-mash
its-mash merged commit cb52e1e into main Apr 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant